import http from '@/api';
export default {
  namespaced: true,
  state: {
    bbsList: [],
  },
  mutations: {
    setBbsList(state, data) {
      console.log(data);
      state.bbsList = data.list;
    },
  },
  actions: {
    getBbsList(context) {
      http.get('/bbs/data-source/user/tableName/bbs').then((res) => {
        context.commit('setBbsList', res.data);
      });
    },
    getDetail(context, detailId) {
      return http.get(`/bbs/data-source/user/tableName/bbs/id/${detailId}`);
    },
    createBBs(context, data) {
      return http.post('/bbs/data-source/user/tableName/bbs', data);
    },
  },
};
